﻿
using System;
using System.IO;

namespace GFramework.Netwrok
{
    public interface INetService : IReference
    {
        event GAction<INetService, INetService> NetServiceAccepted;

        event GAction<INetService, object> NetServiceConnected;

        event GAction<INetService> NetServiceClosed;

        event GAction<INetService> NetServiceSended;

        event GAction<INetService> NetServiceReceived;

        event GAction<INetService, NetErrorCode, int, string> NetServiceError;

        bool Connected { get; }

        byte NetType { get; }

        void Accept(string address);

        void Connect(string address);

        void Connect(string address, object userData);

        void Close();

        void Send(MemoryStream stream);

        void Receive(MemoryStream stream);
    }
}
